package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("pw2.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);

        pw.println("我去多久哦破武器");
        pw.println("额外附件为");

        Scanner scn = new Scanner(System.in);
        while (true){
            String line = scn.nextLine();
            if ("exit".equals(line)){
                break;
            }
            pw.println(line);
            //pw.flush();
        }
        System.out.println("写出完毕！");
        pw.close();
    }
}
